﻿using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using LFSRecord2.Model;

namespace LFSRecord2.View.ViewportStructures
{
    /// <summary>
    /// Interaction logic for LayerViewObject.xaml
    /// </summary>
    public partial class CompLayerViewObject : Canvas
    {
        public CompLayerViewObject()
        {
            InitializeComponent();
        }

        private void CompLayerViewObject_Loaded(object sender, RoutedEventArgs e)
        {
            RenderTransform = new TranslateTransform(1280, 1280);

            // Now we must decide what kind of layer we must draw and load the appropriate object
            switch (((CompLayerBase)DataContext).LayerType)
            {
                case CompLayerTypes.LookCamera:
                    CompLayerLookCameraViewObject camLookView = new CompLayerLookCameraViewObject();
                    camLookView.DataContext = DataContext;
                    Children.Add(camLookView);
                    break;
                case CompLayerTypes.FreeCamera:
                    CompLayerFreeCameraViewObject camFreeView = new CompLayerFreeCameraViewObject();
                    camFreeView.DataContext = DataContext;
                    Children.Add(camFreeView);
                    break;
                case CompLayerTypes.Null:
                    CompLayerNullViewObject nullView = new CompLayerNullViewObject();
                    nullView.DataContext = DataContext;
                    Children.Add(nullView);
                    break;
                case CompLayerTypes.ReplayControl:
                    break;
                case CompLayerTypes.ReplayData:
                    CompLayerRDViewObject replayDataView = new CompLayerRDViewObject();
                    replayDataView.DataContext = DataContext;
                    Children.Add(replayDataView);
                    break;
            }
        }
    }
}
